home *** CD-ROM | disk | FTP | other *** search
/ Belgian Amiga Club - ADF Collection / BS1 part 34.zip / BS1 part 34 / megadisc PD 14.adf / PROGRAMS / AREXX / man.rexx < prev    next >
OS/2 REXX Batch file  |  1989-12-11  |  1KB  |  49 lines

  1. /* UNIX-like `man' command to display documentation files */
  2.  
  3. arg arg1 arg2 arg3 arg4     /* parse the command line */
  4.  
  5. if arg1 = '-D' then ; do    /* we have been given a doc path    */
  6.     if arg4 ~= '' then ; do
  7.         say 'man: too many arguments'
  8.         exit 5
  9.         end
  10.     if arg2 = '' then ; do
  11.         say 'man: missing documentation path'
  12.         exit 5
  13.         end
  14.     if arg3 = '' then ; do
  15.         say 'man: program not specified'
  16.         exit 5
  17.         end
  18.     rt = right( arg2, 1 )           /* Get the doc path into the form   */
  19.     if rt ~= ':' & rt ~= '/' then   /* we want; pathname followed by    */
  20.         docpath = arg2'/'           /* either a ':' or a '/', as        */
  21.     else                            /* appropriate.                     */
  22.         docpath = arg2
  23.     docfile = arg3
  24.     end
  25. else ; do                        /* we should only have a keyword   */
  26.     if arg2 ~= '' then ; do
  27.         say 'man: too many arguments'
  28.         exit 5
  29.         end
  30.     if arg1 = '' then ; do
  31.         say 'Usage: man [-d <DocPath>] <ProgramName>'
  32.         exit 0
  33.         end
  34.     docpath = 'DOC:'
  35.     docfile = arg1
  36.     end
  37.  
  38. if exists( docpath||docfile'.doc' ) then ; do
  39.     address command
  40.     'arun vdk:less' docpath||docfile'.doc'   /* display the doc file */
  41.     exit 0
  42.     end
  43. else ; do       /* can't find the documentation file */
  44.     say 'man: documentation not available'
  45.     exit 10
  46.     end
  47.  
  48.  
  49.